package com.zqh.useraddrcud.controller;

import com.zqh.myfmmall.entity.UserAddr;
import com.zqh.myfmmall.result.Result;
import com.zqh.useraddrcud.service.UserAddrCUDService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-02-18 2:15
 */
@RestController
@RequestMapping("userAddr")
public class UserAddrCUDController{
   @Resource
   private UserAddrCUDService userAddrCUDService;

    @PostMapping("create")
    public Result create(@RequestBody UserAddr userAddr){
        return userAddrCUDService.save(userAddr) ? Result.success() : Result.internalServerError();
    }

    @PutMapping("update")
    Result update (@RequestBody UserAddr userAddr){
        return userAddrCUDService.updateById(userAddr) ? Result.success() : Result.internalServerError();
    }

    @DeleteMapping("delete/{id}")
    Result delete(@PathVariable String id){
        return userAddrCUDService.removeById(id) ? Result.success() : Result.internalServerError();
    }
}
